<?php
/*
 * Created by PhpStorm.
 * User: yezhangtao
 * Date: 2020/11/23
 * Time: 11:10
*/

namespace App\Http\Middleware;


use App\Providers\RouteServiceProvider;
use Illuminate\Support\Facades\Auth;

class GetAccessToken
{
    /**
     * Created by PhpStorm.
     * User: yezhangtao
     * Date: 2020/11/20
     * Time: 13:47
     * @param mixed
     * @param $request \Illuminate\Support\Facades\Request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, \Closure $next){
        //dd($request->header('authorization'));
        if (!$request->header('authorization')){
            return response()->json(["code" => env("FAIL_AUTH_CODE", 401), "msg" => "登录失效,请重新登录", "data" => []]);
        }
        return $next($request);
    }
}
